package com.sofwin.common;

import java.io.Serializable;

/**
 * @packageName: com.sofwin.common
 * @user: andyliu
 * @date: 2021/9/17 16:47
 * @email 115176513@qq.com
 * @description: TODO
 */

public class ResponseData implements Serializable {
    private static final long serialVersionUID = 8226428568409440612L;
    /**
     * 200 正常响应
     * 500
     * 501
     * 600 用户名不存在
     * 601 密码错误
     * 602 验证码错误
     */
    private int code;

    private Object data;

    private String msg;

    public ResponseData(int code,Object data){
        this.code = code;
        this.data =data;
    }

    public ResponseData(int code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public ResponseData(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseData(){

    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static ResponseData success(String message){
        return new ResponseData(200,message);
    }
    public static ResponseData error(){
        return new ResponseData(400,"操作失败");
    }
}
